import { HttpClient } from '@angular/common/http';
import { Injectable } from '@angular/core';
import { StorageProvider } from "../storage/storage";

@Injectable()
export class ConfigProvider {


    // -------------------------------- 测试服
    // public webUrl = "http://t.moments.taoxiansheng.com";
    // public apiUrl = "http://tapi.moments.taoxiansheng.com";
    // public imageUrl = "http://admin.moments.taoxiansheng.com";
    // public authUrl = "http://api.moments.taoxiansheng.com";
    // public shareImgUrl = this.webUrl + '/assets/imgs/share-holder.jpg'
    // public shareImgUrl1 = this.webUrl + '/assets/imgs/share-holder1.jpg'



    // -------------------------------- 正式服
    public webUrl = "http://moments.taoxiansheng.com";
    public apiUrl = "http://api.moments.taoxiansheng.com";
    public imageUrl = "http://admin.moments.taoxiansheng.com";
    public authUrl = "http://api.moments.taoxiansheng.com";
    public shareImgUrl = this.webUrl + '/assets/imgs/share-holder.jpg'
    public shareImgUrl1 = this.webUrl + '/assets/imgs/share-holder1.jpg'

    constructor(
        public http: HttpClient,
        public storage: StorageProvider
    ) {

    }

    public userInfoHolder = {
        user_name: '用户名称',
        nickname: '点击登录',
        head_img: this.webUrl + '/assets/imgs/face-holder.png'
    };

    getToken() {
        let tokenInfo = JSON.parse(this.storage.get('tokenInfo'));
        return tokenInfo['token'];
    }

    getOpenid() {
        let wxInfo = JSON.parse(this.storage.get('wxInfo'));
        return wxInfo['openid'];
    }

    getUserId() {
        let userInfo = JSON.parse(this.storage.get('userInfo'));
        return userInfo['user_id'];
    }


}
